<%--
  User: 高旭
  Date: 2020/12/16 0016
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>产品信息查询</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.8.6/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.8.6/themes/icon.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.8.6/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.8.6/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.8.6/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>

<%--用户展示数据网格--%>
<table class="easyui-datagrid" id="dg" data-options="title:'产品信息查询',fit:true,pagination:true,rownumbers:true,fitColumns:true,toolbar:'#dg-tb',url:'${pageContext.request.contextPath}/product/list.do'">
    <thead>
    <tr>
        <th data-options="field:'cb',checkbox:true,align:'center'"></th>
        <th data-options="field:'id',align:'center'" style="width: 50px">编号</th>
        <th data-options="field:'productName',align:'center'" style="width: 200px">产品名称</th>
        <th data-options="field:'model',align:'center'" style="width: 80px">型号</th>
        <th data-options="field:'unit',align:'center'" style="width: 50px">单位</th>
        <th data-options="field:'price',align:'center'" style="width: 50px">价格</th>
        <th data-options="field:'store',align:'center'" style="width: 50px">库存</th>
        <th data-options="field:'remark',align:'center'" style="width: 200px">备注</th>
    </tr>
    </thead>
</table>
<div id="dg-tb">
    <div>
        <input class="easyui-textbox" id="s_productName" size="40" data-options="label:'&nbsp;产品名称：&nbsp;'">
        <a href="javascript:searchProduct()" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">搜索</a>
    </div>
</div>

</body>
</html>

<script>

    $(function (){
        $('#s_productName').each(function (index,element){
            $(this).textbox('textbox').bind('keydown', function (e) {
                if (e.keyCode == 13) {   // 当按下回车键时接受输入的值。
                    searchCustomer();
                }
            });
        });
    });

    var url = "";

    function searchProduct() {
        $("#dg").datagrid('load', {
            "productName": $("#s_productName").textbox("getValue")
        });
    }


</script>
